package com.ezcoding.controller;

import com.ezcoding.service.MessageService;
import com.jfinal.aop.Before;
import com.jfinal.core.Controller;
import com.jfinal.plugin.activerecord.tx.Tx;

@Before(Tx.class)
public class MessageController extends Controller {

    /**
     * 获取消息
     */
    public void getMessages() {
        String username = getPara("username");

        renderJson(MessageService.getInstance().getMessages(username));
    }

    /**
     * 获取导入消息
     */
    public void getImportMessages() {
        String username = getPara("username");
        //导入消息类型 票款调整：9 收票：开票(5)->收票 收款：付款(8)->收款
        int ticketAdjustType = getParaToInt("ticketAdjustType");
        int type = getParaToInt("type");

        renderJson(MessageService.getInstance().getImportMessage(username, ticketAdjustType, type));
    }
}
